<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 二课堂学生储存空间</title>
    <!-- 使用url_for确保正确加载静态资源 -->
    <link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}">
</head>
<body class="bg-light">
    <div class="container">
        <form class="card p-4 mx-auto mt-5" style="max-width: 350px" action="{{ url_for('login') }}" method="post">
            <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

            <h1 class="text-center text-primary mb-4">二课堂学生储存空间</h1>
            <hr class="text-primary mb-4">

            <!-- 显示Flash消息 -->
            {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                    {% for category, message in messages %}
                        <div class="alert alert-{{ 'danger' if category == 'error' else 'success' }} mb-3">
                            {{ message }}
                        </div>
                    {% endfor %}
                {% endif %}
            {% endwith %}

            <div class="mb-3">
                <label for="username" class="form-label">用户名</label>
                <input type="text" class="form-control" id="username" name="username" required
                       placeholder="请输入用户名">
            </div>

            <div class="mb-3">
                <label for="password" class="form-label">密码</label>
                <input type="password" class="form-control" id="password" name="password" required
                       placeholder="请输入密码">
            </div>

            <button type="submit" class="btn btn-primary w-100">登录</button>
        </form>
    </div>

    <!-- 放在body底部提高加载速度 -->
    <script src="{{ url_for('static', filename='bootstrap/js/bootstrap.bundle.min.js') }}"></script>

    <!-- 可选的jQuery（如果需要Bootstrap的JS功能） -->
    <!-- <script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script> -->
</body>
</html>